#include "Gk.h"

#ifdef GK_DEVICE_NULL

#include "GkDevice.Null.h"
#include "..\GkContext.GenericDeferred.h"

namespace gk
{
	DeviceHandle CreateDevice()
	{
		return new DeviceNull;
	}

	void DeviceNull::Initialise(InitParamsHandle hInitParams)
	{
		DeviceCommon::InitialisePlatform(hInitParams);
		DeviceCommon::InitialiseCommon(hInitParams);
	}

	void DeviceNull::Shutdown()
	{
		DeviceCommon::ShutdownCommon();
		DeviceCommon::ShutdownPlatform();
	}

	bool DeviceNull::Present()
	{
		return pf::GetPlatform()->Present();
	}

	// Object creation
	void DeviceNull::CreateContext(ContextHandle hContext)
	{
	}

	void DeviceNull::CreateBuffer(BufferHandle hBuffer)
	{
	}

	void DeviceNull::CreateRenderTarget(RenderTargetHandle hRenderTarget)
	{
	}

	void DeviceNull::CreateRenderSurface(RenderSurfaceHandle hRenderSurface)
	{
	}

	void DeviceNull::CreateTexture(TextureHandle hTexture)
	{
	}

	void DeviceNull::CreateStreamDescription(StreamDescriptionHandle hStreamDescription)
	{
	}

	void DeviceNull::CreateRenderBinding(RenderBindingHandle /*hRenderBinding*/)
	{
	}

	void DeviceNull::CreateGpuProgram(GpuProgramHandle hGpuProgram)
	{
	}

	void DeviceNull::CreateStateBlock(StateBlockHandle hStateBlock)
	{
	}

	void DeviceNull::CreateConstantBuffer(ConstantBufferHandle hConstantBuffer)
	{
		cr::ClearObject(hConstantBuffer->m_internal);
	}

	// Object destruction
	void DeviceNull::ReleaseContext(ContextHandle hContext)
	{
	}

	void DeviceNull::ReleaseBuffer(BufferHandle hBuffer)
	{
	}

	void DeviceNull::ReleaseRenderTarget(RenderTargetHandle hRenderTarget)
	{
	}

	void DeviceNull::ReleaseRenderSurface(RenderSurfaceHandle hRenderSurface)
	{
	}

	void DeviceNull::ReleaseTexture(TextureHandle hTexture)
	{
	}

	void DeviceNull::ReleaseStreamDescription(StreamDescriptionHandle hStreamDescription)
	{
	}

	void DeviceNull::ReleaseRenderBinding(RenderBindingHandle /*hRenderBinding*/)
	{
	}

	void DeviceNull::ReleaseGpuProgram(GpuProgramHandle hGpuProgram)
	{
	}

	void DeviceNull::ReleaseStateBlock(StateBlockHandle hStateBlock)
	{
	}

	void DeviceNull::ReleaseConstantBuffer(ConstantBufferHandle hConstantBuffer)
	{
		cr::ClearObject(hConstantBuffer->m_internal);
	}
}



#endif // GK_DEVICE_NULL